package com.cango.student.Decorator;

public abstract class AbstractCoffee implements Coffee {

    Coffee coffee;

    public AbstractCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    interface InterCalculate {
        int cost();
    }

    public abstract int addCash(InterCalculate function);

    @Override
    public int cost() {
        return addCash(new InterCalculate() {
            @Override
            public int cost() {
                return coffee.cost();
            }
        });
    }
}
